<?php
/**
 * Created by PhpStorm.
 * User: 陈鸿
 * Date: 2016/5/17
 * Time: 21:21
 */

namespace QC;


class Curl
{
    static public function get($url)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
        $result = curl_exec($ch);
        curl_close($ch);
        return $result;
    }

    static public function post($url,$arr)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
        curl_setopt($ch, CURLOPT_POST, TRUE);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $arr);
        $result = curl_exec($ch);
        curl_close($ch);
        return $result;
    }
}